//
//  TitleView.m
//  TTDT_1
//
//  Created by lanou on 15/9/8.
//  Copyright (c) 2015年 zhengyl. All rights reserved.
//

#import "TitleView.h"
#import "Define.h"
@implementation TitleView

-(void)dealloc{

    _delegate = nil;
}

-(instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
        
        _myBtn = [DIYButton buttonWithType:UIButtonTypeCustom];
        _myBtn.frame = CGRectMake(10, 0, (kScreenWidth - 80) / 4, kTitleHeight);
        _myBtn.textlabel.text = @"我的";
        [_myBtn addTarget:self action:@selector(myBtn:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_myBtn];
        
        _listenBtn = [DIYButton buttonWithType:UIButtonTypeCustom];
        _listenBtn.frame = CGRectMake(30 + (kScreenWidth - 80) / 4, 0, (kScreenWidth - 80) / 4 , kTitleHeight);
        _listenBtn.textlabel.text = @"听";
        _listenBtn.image.hidden = YES;
       [_listenBtn addTarget:self action:@selector(listenBtn:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_listenBtn];
        
        _categoryBtn = [DIYButton buttonWithType:UIButtonTypeCustom];
        _categoryBtn.frame = CGRectMake(50 + 2 * (kScreenWidth - 80) / 4 , 0, (kScreenWidth - 80) / 4, kTitleHeight);
        _categoryBtn.textlabel.text = @"分类";
        _categoryBtn.image.hidden = YES;
        [_categoryBtn addTarget:self action:@selector(categoryBtn:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_categoryBtn];
        
        _dayBtn = [DIYButton buttonWithType:UIButtonTypeCustom];
        _dayBtn.frame = CGRectMake(70 + 3 * (kScreenWidth - 80) / 4, 0, (kScreenWidth - 80) / 4, kTitleHeight);
        _dayBtn.textlabel.text = @"每天";
        _dayBtn.image.hidden = YES;
     [_dayBtn addTarget:self action:@selector(dayBtn:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_dayBtn];
    }
    return self;
}
#pragma mark-=-=点击方法的实现

-(void)myBtn:(UIButton *)button
{
    if ([_delegate respondsToSelector:@selector(touchview)]) {
        [_delegate touchview];
    }
}
-(void)listenBtn:(UIButton *)button{

    if ([_delegate respondsToSelector:@selector(touchB)]) {
        [_delegate touchB];
    }
    
}
-(void)categoryBtn:(UIButton *)button{
    if ([_delegate respondsToSelector:@selector(touchM)]) {
        [_delegate touchM];
    }
}
-(void)dayBtn:(UIButton *)button{
    if ([_delegate respondsToSelector:@selector(touchE)]) {
        [_delegate touchE];
    }
}



@end
